//
//  LHRecommendHotelViewController.m
//  Knight_Tour
//
//  Created by Bruce_Lin on 15/5/13.
//  Copyright (c) 2015年 TouchOne. All rights reserved.
//

#import "LHRecommendHotelViewController.h"
#import "LHRecommendHotelTableView.h"
#import "LHRecommendHotelDetailViewController.h"
#import "MyNavgationView.h"
#import "LHRecommendHotelModel.h"

@interface LHRecommendHotelViewController ()<jumpToHotelDetailDelegate>

@end

@implementation LHRecommendHotelViewController

- (void)dealloc
{
    [_cityId_hotel release];
    [super dealloc];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.title = @"推荐旅店列表";
    
    self.view.backgroundColor = [UIColor colorWithRed:0.871 green:0.962 blue:0.965 alpha:1.000];
    self.automaticallyAdjustsScrollViewInsets = NO;
    [self createRecommendHotelView];
    [self createNavigation];
}


// 创建自定义导航栏
- (void)createNavigation
{
    MyNavgationView *myNaView = [[MyNavgationView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 64)];
    
    [myNaView creatTitle:@""];
    
    myNaView.leftTarget = self;
    myNaView.leftAction = @selector(backToCityHomePageController);
    
    [myNaView creatLeftButtonWithImage:@"btn_nav_back"];
    
    
    
    [self.view addSubview:myNaView];
    
    [myNaView release];
    
}

- (void)backToCityHomePageController
{
    [self.navigationController popViewControllerAnimated:YES];
}
/**
 *  创建推荐旅店列表
 */

- (void)createRecommendHotelView
{
    LHRecommendHotelTableView *recommendHotel = [[LHRecommendHotelTableView alloc] initWithFrame:CGRectMake(0, 64, self.view.frame.size.width, self.view.frame.size.height - 34) cityId:self.cityId_hotel];
    
    [self.view addSubview:recommendHotel];
    
    recommendHotel.delegate = self;
    
    [recommendHotel release];
    
}

/**
 *  实现跳转到旅店详情页面点击方法
 */
- (void)jumpToHotelDetailWithIndexPath:(NSIndexPath *)indexPath hotelArr:(NSMutableArray *)hotelArr
{
    LHRecommendHotelDetailViewController *hotelDetailVC = [[[LHRecommendHotelDetailViewController alloc] init] autorelease];
    
    hotelDetailVC.hotelModel = hotelArr[indexPath.row];
    
    [self.navigationController pushViewController:hotelDetailVC animated:YES];
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
